<template>
  <view>
    <view class="colorB" style="padding:30rpx;" v-for="(item ,index) in pileList" :index="index" :key="index">
      <view class="mainColor border-10" style="border: 1px solid #fff;">
        <view class="flex justify-between align-center padding-10">
          <view class="color0">
            <navigator :url="'/equipment/index/index?id='+ item.pileId">
              桩号：{{item.pileSn}}
            </navigator>
          </view>
          <view>{{pileStatus(item.status) }}</view>
        </view>
        <view class=" padding-10">接口数量：{{item.gunNum}}</view>
        <view class=" padding-10">电桩类型：{{connectorType(item.pileType) }}</view>
        <view class="flex justify-between align-center padding-10">
          <!-- <view class="">站点类型：{{stationtype(item.stationType)}}</view>
          <view class="">站点状态：{{stationStatus(item.stationStatus )}}</view> -->
        </view>
        <view class="padding-10">运营商：{{item.merchantName}}</view>
        <view class="padding-10">充电站：{{item.stationName}}</view>
        <view class="padding-10">注册时间：{{item.registrationTime || '一'}}</view>
        <!-- <view class="text padding-10">微信商户订单号：{{item.outTradeNo === null ? '一':item.outTradeNo}}</view> -->
      </view>
    </view>

    <!-- 分页 -->
    <uni-pagination show-icon :page-size="queryParams.pageSize" :current="queryParams.pageNum" :total="total"
      @change="change" />
    <view class="btn-view;mainColor border-10">
      <view class="">
        <text
          class="example-info">当前页：{{ queryParams.pageNum }}，数据总量：{{ total }}条，每页数据：{{ queryParams.pageSize }}</text>
      </view>
      <view class="btn-flex ">
        <button class="button word-btn" hover-class="word-btn--hover" :hover-start-time="20" :hover-stay-time="70"
          @click="add"><text class="word-btn-white">增加10条数据</text></button>
        <button class="button" type="default" @click="reset" style="margin-left: 40rpx;">重置数据</button>
      </view>
    </view>
  </view>
</template>

<script>
  import {
    checkPermi,
    checkRole
  } from "@/utils/permission";
  import {
    listBasic
  } from "@/api/pile/basic";
  import {
    pileStatus,
    connectorType,
    payStatus
  } from '@/common/dict.js'
  export default {
    props: ['stationId'],
    data() {
      return {
        pileStatusList: [],
        connectorTypeList: [],
        payStatusList: [],
        dateDescription: '',
        sumOrderAmount: '',
        sumUsedElectricity: '',
        // 遮罩
        loading: true,
        // 选中数组
        ids: [],
        // 子表选中数据
        checkedOrderDetail: [],
        // 非单个禁用
        single: true,
        // 非多个禁用
        multiple: true,
        // 显示搜索条件
        showSearch: true,
        // 总条数
        total: 0,
        // 订单表格数据
        pileList: [],
        // 订单详情表格数据
        orderDetailList: [],
        // 弹出层标题
        title: "",
        // 是否显示弹出层
        open: false,
        // 查询参数
        queryParams: {
          pageNum: 1,
          pageSize: 10,
          pileSn: null,
          stationId: this.stationId,
        },
        // 表单参数
        form: {},
        // 表单校验
        rules: {},
        // 站点列表
        stationList: [],
        // 订单创建时间范围
        createTimeRange: [],
      };
    },
    methods: {
      checkPermi,
      checkRole,
      add() {
        this.queryParams.pageSize += 10
        this.getPileList();
      },
      reset() {
        this.queryParams.pageSize = 10
        this.queryParams.pageNum = 1
        this.getPileList();
      },
      change(e) {
        console.log(e.current);
        this.queryParams.pageNum = e.current
        this.getPileList()
      },
      connectorType(sim) {
        connectorType.then(result => {
          this.connectorTypeList = result
        })
        let str = this.connectorTypeList.find(item => item.dictValue == sim)
        if (str == undefined) {
          return '一'
        } else {
          return str.dictLabel
        }
      },
      payStatus(sim) {
        payStatus.then(result => {
          this.payStatusList = result
        })
        let str = this.payStatusList.find(item => item.dictValue == sim)
        if (str == undefined) {
          return '一'
        } else {
          return str.dictLabel
        }
      },
      pileStatus(sim) {
        pileStatus.then(result => {
          this.pileStatusList = result
        })
        let str = this.pileStatusList.find(item => item.dictValue == sim)
        if (str == undefined) {
          return '一'
        } else {
          return str.dictLabel
        }
      },
      getPileList() {
        // this.queryParams.stationId = this.stationId;
        listBasic(this.queryParams).then(response => {
          this.pileList = response.rows;
          console.log('this.pileList', this.pileList)
          this.total = response.total;
        });
      },
    },
    created() {
      this.getPileList()
    }
  }
</script>

<style lang="scss">

</style>